package com.cooksys.film_rental.bo;

import java.util.List;

import com.cooksys.film_rental.model.Address;
import com.cooksys.film_rental.model.City;
import com.cooksys.film_rental.model.Country;

/**
 * Business Object for the {@link City} class.
 * 
 * @author Peter Zastoupil
 * 
 */
public interface CityBo {

	/**
	 * Saves a given {@link City} as a record in the database
	 * 
	 * @param city
	 *            the City to save
	 * @return the {@link City} that was saved
	 */
	public City save(City city);

	/**
	 * 
	 * @param city
	 *            the City to save or update
	 */
	public void saveOrUpdate(City city);

	/**
	 * Updates the database record associated with the given {@link City}
	 * 
	 * @param city
	 *            the City to be updated
	 */
	public void update(City city);

	/**
	 * Deletes the database record associated with the given {@link City}
	 * 
	 * @param city
	 *            the City to be deleted
	 */
	public void delete(City city);

	/**
	 * 
	 * @param cityId
	 *            the cityId to search by
	 * @return a {@link City} object that corresponds to the given cityId
	 */
	public City getCityByCityId(Short cityId);

	/**
	 * 
	 * @param cityId
	 *            a String representation of the cityId to search by
	 * @return a {@link City} object that corresponds to the given cityId
	 */
	public City getCityByCityId(String cityId);

	/**
	 * 
	 * @param address
	 *            the {@link Address} to search by
	 * @return the {@link City} object associated with the given address
	 */
	public City getCityByAddress(Address address);

	/**
	 * 
	 * @param country
	 *            the {@link Country} to search by
	 * @return a List of {@link City} objects associated with the given country
	 */
	public List<City> searchCitiesByCountry(Country country);

	/**
	 * Searches the database for {@link City} objects that match the given
	 * partialCityName
	 * 
	 * @param partialCityName
	 *            the partialCityName to search by
	 * @return a List of {@link City} objects that match the given
	 *         partialCityName
	 */
	public List<City> searchCitiesByPartialCityName(String partialCityName);

	/**
	 * 
	 * @return a List of all available {@link City} objects
	 */
	public List<City> getAllCities();

	/**
	 * 
	 * @param city
	 *            the {@link City} object to be matched by a database record
	 * @param country
	 *            the {@link Country} object associated with the given city
	 * @return a {@link City} object from the database that matches the given
	 *         city and country
	 */
	public City matchCityToDatabase(City city, Country country);

}